from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from django.db import DatabaseError
# 需求：让DRF能狗处理DatabaseError

#GET /goods/
class GoodsView(APIView):
    def get(self,request):

        # 抛出异常
        # raise Http404
        raise DatabaseError
        return Response({'message':'OK'})